package net.onceface.web.resources;

import javax.inject.Inject;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

import net.onceface.application.DeliveryMSGApplication;
import net.onceface.core.mongo.DeliveryMSG;

import org.apache.log4j.Logger;

@Path("/test")
public class TestResource {

	Logger logger  =  Logger.getLogger(TestResource.class );
	@Inject
	DeliveryMSGApplication deliveryMSGApplication;
	
	@GET
	@Path("/test1")
	@Consumes(MediaType.APPLICATION_JSON)
	@Produces(MediaType.APPLICATION_JSON)
	public String test1(){
		logger.debug("test,test");
		logger.info("test,test");
		logger.warn("warn");
		logger.error("测试：这是一条记录错误的日志");
		return "ok";
	}
	
	@GET
	@Path("/test2")
	@Consumes(MediaType.APPLICATION_JSON)
	@Produces(MediaType.APPLICATION_JSON)
	public Object test2(){
		DeliveryMSG m = deliveryMSGApplication.findByUserId(109);
		return m;
	}
}
